/*
 * Copyright (c) 2008 Benoit Bouchez, Nicolas Giard
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
package com.noocodecommit.wicket.stuff.jquery.plugin.ui.resizable;

import com.noocodecommit.wicket.stuff.jquery.plugin.JQPluginOptions;

/**
 * JQResizable Option set
 * 
 * @author Benoit Bouchez
 * 
 */
public class JQResizableOptions extends JQPluginOptions implements Cloneable
{

	private boolean autohide;
	private String handles;
	private String containment;
	private int maxHeight;
	private int maxWidth;
	private int minHeight;
	private int minWidth;
	private String proxy;
	private boolean destructive;
	private String proportionallyResize;

	private String startScript = "";
	private String resizeScript = "";
	private String stopScript = "";

	/**
	 * Constructor
	 */
	public JQResizableOptions()
	{
		super();
		this.setDefaultHeader("resizable");
	}

	/**
	 * Gets the auto hide value
	 * 
	 * @return the auto hide value
	 */
	public boolean isAutohide()
	{
		return autohide;
	}

	/**
	 * Sets the auto hide option value
	 * 
	 * @param autohide
	 *            resizable auto hide
	 */
	public void setAutohide(boolean autohide)
	{
		this.autohide = autohide;
		this.options.put("autohide", "autohide:" + autohide);
	}

	/**
	 * Gets the handles value
	 * 
	 * @return the handles value
	 */
	public String getHandles()
	{
		return handles;
	}

	/**
	 * Sets the handles option value
	 * 
	 * @param handles
	 *            resizable handles
	 */
	public void setHandles(String handles)
	{
		this.handles = handles;
		this.options.put("handles", "handles:'" + handles + "'");
	}

	/**
	 * Gets the containment value
	 * 
	 * @return the containment value
	 */
	public String getContainment()
	{
		return containment;
	}

	/**
	 * Sets the containment option value
	 * 
	 * @param containment
	 *            resizable containment
	 */
	public void setContainment(String containment)
	{
		this.containment = containment;
		this.options.put("containment", "containment:'" + containment + "'");
	}

	/**
	 * Gets the max height value
	 * 
	 * @return the max height value
	 */
	public int getMaxHeight()
	{
		return maxHeight;
	}

	/**
	 * Sets the max height option value
	 * 
	 * @param maxHeight
	 *            resizable max height
	 */
	public void setMaxHeight(int maxHeight)
	{
		this.maxHeight = maxHeight;
		this.options.put("maxHeight", "maxHeight:" + maxHeight);
	}

	/**
	 * Gets the max width value
	 * 
	 * @return the max width value
	 */
	public int getMaxWidth()
	{
		return maxWidth;
	}

	/**
	 * Sets the max width option value
	 * 
	 * @param maxWidth
	 *            resizable max width
	 */
	public void setMaxWidth(int maxWidth)
	{
		this.maxWidth = maxWidth;
		this.options.put("maxWidth", "maxWidth:" + maxWidth);
	}

	/**
	 * Gets the min height value
	 * 
	 * @return the min height value
	 */
	public int getMinHeight()
	{
		return minHeight;
	}

	/**
	 * Sets the min height option value
	 * 
	 * @param minHeight
	 *            resizable min height
	 */
	public void setMinHeight(int minHeight)
	{
		this.minHeight = minHeight;
		this.options.put("minHeight", "minHeight:" + minHeight);
	}

	/**
	 * Gets the min width value
	 * 
	 * @return the min width value
	 */
	public int getMinWidth()
	{
		return minWidth;
	}

	/**
	 * Sets the min width option value
	 * 
	 * @param minWidth
	 *            resizable min width
	 */
	public void setMinWidth(int minWidth)
	{
		this.minWidth = minWidth;
		this.options.put("minWidth", "minWidth:" + minWidth);
	}

	/**
	 * Gets the proxy value
	 * 
	 * @return the proxy value
	 */
	public String getProxy()
	{
		return proxy;
	}

	/**
	 * Sets the proxy option value
	 * 
	 * @param proxy
	 *            resizable proxy
	 */
	public void setProxy(String proxy)
	{
		this.proxy = proxy;
		this.options.put("proxy", "proxy:'" + proxy + "'");
	}

	/**
	 * Gets the destructive value
	 * 
	 * @return the destructive value
	 */
	public boolean isDestructive()
	{
		return destructive;
	}

	/**
	 * Sets the destructive option value
	 * 
	 * @param destructive
	 *            resizable destructive
	 */
	public void setDestructive(boolean destructive)
	{
		this.destructive = destructive;
		this.options.put("destructive", "destructive:" + destructive);
	}

	/**
	 * Gets the proportionally resize value
	 * 
	 * @return the proportionally resize value
	 */
	public String getProportionallyResize()
	{
		return proportionallyResize;
	}

	/**
	 * Sets the proportionnally resize option value
	 * 
	 * @param proportionallyResize
	 *            resizable proportionnally resize
	 */
	public void setProportionallyResize(String proportionallyResize)
	{
		this.proportionallyResize = proportionallyResize;
		this.options.put("proportionallyResize", "proportionallyResize:'" + proportionallyResize + "'");
	}

	/**
	 * Gets the start script value
	 * 
	 * @return the start function
	 */
	public String getStartScript()
	{
		return startScript;
	}

	/**
	 * Sets the start function
	 * 
	 * @param startScript
	 *            resizable start function
	 */
	public void setStartScript(String startScript)
	{
		this.startScript = startScript;
		this.options.put("start", "start:function(e, ui){" + startScript + "}");
	}

	/**
	 * Gets the resize script value
	 * 
	 * @return the resize function
	 */
	public String getResizeScript()
	{
		return resizeScript;
	}

	/**
	 * Sets the resize function
	 * 
	 * @param resizeScript
	 *            resizable start function
	 */
	public void setResizeScript(String resizeScript)
	{
		this.resizeScript = resizeScript;
		this.options.put("resize", "resize:function(e, ui){" + resizeScript + "}");
	}

	/**
	 * Gets the stop script value
	 * 
	 * @return the stop function
	 */
	public String getStopScript()
	{
		return stopScript;
	}

	/**
	 * Sets the stop function
	 * 
	 * @param stopScript
	 *            resizable stop function
	 */
	public void setStopScript(String stopScript)
	{
		this.stopScript = stopScript;
		this.options.put("stop", "stop:function(e, ui){" + stopScript + "}");
	}

	@Override
	protected Object clone() throws CloneNotSupportedException
	{
		JQResizableOptions clone = (JQResizableOptions)super.clone();
		return clone;
	}
}
